package org.wmq.positiontoshop.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.wmq.positiontoshop.interceptor.LoginInterceptor;

@Configuration
@Data
public class ApplicationConfiguration implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    @Value("${app.avatar.minio.bucket.user}")
    private String userAvatarBucket;
    @Value("${app.avatar.minio.bucket.shop")
    private String shopAvatarBucket;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.loginInterceptor).addPathPatterns("/**").excludePathPatterns("/auth/**");
    }
}
